package com.qupai.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.qupai.dto.AuctionDTO;
import com.qupai.entity.Auction;
import com.qupai.mapper.AuctionMapper;
import com.qupai.service.IAuctionService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;


/**
 * <p>
 * 拍卖表，存储拍卖活动信息 服务实现类
 * </p>
 *
 * @author bluefoxyu
 * @since 2024-07-30
 */
@Service
@RequiredArgsConstructor
public class AuctionServiceImpl extends ServiceImpl<AuctionMapper, Auction> implements IAuctionService {

    private final AuctionMapper auctionMapper;


    @Override
    public Auction updateAuction(AuctionDTO auctionDTO) {
        Auction auction = Auction.builder()
                .id(auctionDTO.getId())
                .name(auctionDTO.getName())
                .startTime(auctionDTO.getStartTime())
                .endTime(auctionDTO.getEndTime())
                .build();
        auctionMapper.updateById(auction);
        return auction;
    }
}
